f=open(r'3.1.txt','w+')
f.write('chriswpf1\n')
f.write('chriswpf2\n')
f.write('chriswpf3\n')
f.write('chriswpf4\n')
f.write('chriswpf5\n')
f.seek(0)
print("读5个字符是：",f.read(5))
f.seek(0)
print("读第一行字符串是：",f.readline())
f.seek(0)
i=1
while i<3:
    f.readline()
    i+=1
print("读第三行字符串是：",f.readline())
f.seek(0)
print("读取所有行字符串是：")
r=f.readlines()
for row in r:
    print(row[0:-1],end=' ')
